# -*- coding: utf-8 -*-
"""
Created on Tue Feb 19 14:55:43 2013

@author: aponteeduarddo@gmail.com
Copyright Eduardo Aponte 2013.
"""

from mex_binder import binder_py

mx_eyelink_set_name = binder_py('mx_eyelink_set_name')
mx_eyelink_set_name.mx_c.headers = ['<eyelink.h>','"mex.h"']
mx_eyelink_set_name.mx_c.code = '''

void _main( char *ops )
{
    eyelink_set_name( ops );
}


void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
    char *mb;    
    /* Verify input arguments. */
    if(nrhs != 1 ) {
        mexErrMsgTxt("Incorrect number of inputs.");
    } else if( nlhs != 0 ) {
        mexErrMsgTxt("Too many output arguments.");
    }
    
    if ( mxIsChar(*prhs) != 1 )
      mexErrMsgTxt( "name must be a string." );
      
    mb  = mxArrayToString(*prhs);
    
    if(mb == NULL) 
      mexErrMsgTxt("Could not convert input to string.");
    
    _main( mb );    
    mxFree( mb );
    return;
}


'''

mx_eyelink_set_name.mx_c.mdoc = \
'''function [ status ] = mx_eyelink_set_name( )
%MX_EYELINK_SET_NAME Sets the node name of this computer (up to 35 characters).
%
% Parameters:
% name 	String to become new name.
%
'''
mx_eyelink_set_name.write_c()
mx_eyelink_set_name.write_m()
mx_eyelink_set_name.compile()
mx_eyelink_set_name.write_sh()

